package enumdemo;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

public class Test {

    public static void main(String[] args) {
        Class<?> c = null;

        try {
            c = Class.forName("enumdemo.TestEnum");

            Constructor<?> constructor = c.getDeclaredConstructor(String.class, int.class, String.class, int.class);
            constructor.setAccessible(true);

            TestEnum testEnum = (TestEnum) constructor.newInstance("粉色", 7);

            System.out.println(testEnum);

        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
    }
}
